import { createSlice } from '@reduxjs/toolkit'

interface SchedulingState {
  schedules: any[]
  shifts: any[]
  loading: boolean
  error: string | null
}

const initialState: SchedulingState = {
  schedules: [],
  shifts: [],
  loading: false,
  error: null,
}

const schedulingSlice = createSlice({
  name: 'scheduling',
  initialState,
  reducers: {
    setSchedules: (state, action) => {
      state.schedules = action.payload
    },
    setShifts: (state, action) => {
      state.shifts = action.payload
    },
  },
})

export const { setSchedules, setShifts } = schedulingSlice.actions
export default schedulingSlice.reducer